import Vue from 'vue'
import App from './App.vue'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import router from './router/index'


Vue.config.productionTip = false

Vue.use(ElementUI);


// 全局路由守卫
router.beforeEach((to, from, next) => {
  // console.log('去到', to.path)
  // console.log('从这个', from.path)
  if (sessionStorage.getItem('Token')) {
    next()
  } else {
    if (to.path !== '/login') {
      next({path: '/login'})
    } else {
      next()
    }
  }
})

new Vue({
  render: h => h(App),
  router,
}).$mount('#app')
